/*
 * Created by JFormDesigner on Thu Apr 13 08:47:17 CST 2023
 */

package com.canteen.gui.customerinformationform;

import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;

/**
 * @author jf302
 */
public class CustomerInformationForm extends JFrame {
    public CustomerInformationForm() {
        initComponents();
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        customerNameLabel = new JLabel();
        customerNameInput = new JTextField();
        customerPhoneLabel = new JLabel();
        customerPhoneInput = new JTextField();
        queryButton = new JButton();
        scrollPane1 = new JScrollPane();
        customerInformationTable = new JTable();
        modificationButton = new JButton();
        deleteButton = new JButton();

        //======== this ========
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);
        setTitle("\u987e\u5ba2\u4fe1\u606f\u67e5\u8be2");
        var contentPane = getContentPane();
        contentPane.setLayout(null);

        //---- customerNameLabel ----
        customerNameLabel.setText("\u987e\u5ba2\u59d3\u540d\uff1a");
        contentPane.add(customerNameLabel);
        customerNameLabel.setBounds(new Rectangle(new Point(35, 25), customerNameLabel.getPreferredSize()));
        contentPane.add(customerNameInput);
        customerNameInput.setBounds(95, 20, 105, 25);

        //---- customerPhoneLabel ----
        customerPhoneLabel.setText("\u987e\u5ba2\u624b\u673a\uff1a");
        contentPane.add(customerPhoneLabel);
        customerPhoneLabel.setBounds(235, 25, 60, 15);
        contentPane.add(customerPhoneInput);
        customerPhoneInput.setBounds(295, 20, 150, 25);

        //---- queryButton ----
        queryButton.setText("\u67e5\u627e");
        contentPane.add(queryButton);
        queryButton.setBounds(365, 60, 80, queryButton.getPreferredSize().height);

        //======== scrollPane1 ========
        {

            //---- customerInformationTable ----
            customerInformationTable.setModel(new DefaultTableModel(
                new Object[][] {
                    {null, null, null, null, null, null},
                    {null, null, null, null, null, null},
                },
                new String[] {
                    "\u5e8f\u53f7", "\u59d3\u540d", "\u624b\u673a", "\u5730\u5740", "\u5907\u6ce8", "\u521b\u5efa\u65f6\u95f4"
                }
            ));
            {
                TableColumnModel cm = customerInformationTable.getColumnModel();
                cm.getColumn(0).setPreferredWidth(50);
            }
            scrollPane1.setViewportView(customerInformationTable);
        }
        contentPane.add(scrollPane1);
        scrollPane1.setBounds(35, 110, 425, 175);

        //---- modificationButton ----
        modificationButton.setText("\u4fee\u6539");
        contentPane.add(modificationButton);
        modificationButton.setBounds(270, 305, 80, modificationButton.getPreferredSize().height);

        //---- deleteButton ----
        deleteButton.setText("\u5220\u9664");
        contentPane.add(deleteButton);
        deleteButton.setBounds(365, 305, 80, 23);

        {
            // compute preferred size
            Dimension preferredSize = new Dimension();
            for(int i = 0; i < contentPane.getComponentCount(); i++) {
                Rectangle bounds = contentPane.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = contentPane.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            contentPane.setMinimumSize(preferredSize);
            contentPane.setPreferredSize(preferredSize);
        }
        setSize(500, 390);
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    private JLabel customerNameLabel;
    private JTextField customerNameInput;
    private JLabel customerPhoneLabel;
    private JTextField customerPhoneInput;
    private JButton queryButton;
    private JScrollPane scrollPane1;
    private JTable customerInformationTable;
    private JButton modificationButton;
    private JButton deleteButton;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
